
package uk.ac.manchester.tewpl.iceiface.client.explorer.nodes;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.user.client.rpc.AsyncCallback;

import uk.ac.manchester.tewpl.iceiface.client.Functors.IterativeLoader;
import uk.ac.manchester.tewpl.iceiface.client.Functors.VoidCallback;
import uk.ac.manchester.tewpl.iceiface.client.explorer.FilterResult;
import uk.ac.manchester.tewpl.iceiface.client.explorer.types.Uri;
import uk.ac.manchester.tewpl.iceiface.client.model.KBClassModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBIndividualModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBObjectPropertyModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBWorkspaceModel;
import uk.ac.manchester.tewpl.iceiface.client.service.KBServiceAsync;

/*
 * Class to represent a Terminal, instances of which
 * are kept by Airports.
 */
public class Terminal extends Node {
	
	// KnowledgeBase variables
	private KBServiceAsync kbservice = Registry.get("kbservice");
	private KBWorkspaceModel ws = Registry.get("workspace");
	
	// Terminal identifiers
	private Uri uri;
	private String label;
	private KBClassModel terminal;
	private Airport parentAirport;

	// Filter results that match this terminal
	private Collection<FilterResult> filterResults;
	private Collection<String> filterKeywords;
	private boolean filterIsApplied;
	
	/*
	 * Constructor, accepting a KBClassModel
	 */
	public Terminal(KBClassModel t, Airport pAirport) {
		terminal = t;
		label = terminal.getLabel();
		uri = new Uri(terminal.getUri());
		parentAirport = pAirport;
	}
	
	/*
	 * Return the Terminal's Uri
	 */
	public Uri getUri() {
		return uri;
	}
	
	/*
	 * Return the Terminal's label
	 */
	public String getLabel() {
		if (label != null)
			return label;
		else
			return uri.toString();
	}
	
	/*--------------------------------
	 * Filter Methods
	 * -------------------------------*/
	
	@Override
	public void addKeywordFilter(String keyword) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addResult(FilterResult result) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addResults(Collection<FilterResult> results) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void clearFilters() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getCount() {
		if (filterIsApplied) {
			return -1;
		} else {
			return terminal.getMemberCount();
		}
	}

	@Override
	public Collection<String> getFilterKeywords() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Collection<FilterResult> getResults() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setFilterIsApplied() {
		// TODO Auto-generated method stub
		
	}

}
